package edu.erpan.bl.bean;

import java.util.List;
import javax.ejb.LocalBean;
import javax.ejb.Stateful;
import javax.persistence.Query;
import edu.erpan.bl.entities.Maquinaria;
import edu.erpan.util.entityManager.GenericEntityManager;

import edu.erpan.util.entityManager.exceptions.QueryException;


@Stateful
@LocalBean
public class MaquinariaBean extends GenericEntityManager<Maquinaria> implements MaquinariaBeanRemote<Maquinaria>{

	 public MaquinariaBean() {
	        // TODO Auto-generated constructor stub
	    	super(Maquinaria.class);
	    }

	 @SuppressWarnings("unchecked")
	 
	 public List<Maquinaria> datosRMaquinas() throws QueryException {
		    
		 String p="SELECT  m from Maquinaria m";
		 
	        try{
	        	
	        	Query j=getEntityManager().createQuery(p);   	
	        	List<Maquinaria> entities = j.getResultList();
	        		
		        return entities;
	        }catch (Exception e) {
	        	throw new QueryException(e);
	        }
	        
	    }
	 
	 
	 
}
